package com.fastloan.mgt;

import com.fastloan.mgt.application.base.enums.ApplicationStatusEnum;
import com.fastloan.mgt.application.base.model.Application;
import com.fastloan.mgt.application.base.service.ApplicationService;
import com.kawins.result.ResultTo;
import com.kawins.supers.socket.manager.SocketMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author rankai
 *         createTime 2017-12-2017/12/22 10:42
 */
@RestController
@RequestMapping("/api/verify")
public class MessageTest {

    @Autowired
    private ApplicationService applicationService;

    @GetMapping("/web")
    public ResultTo test() {
        SocketMessage socketMessage = new SocketMessage(1);
        socketMessage.setLevel(1);
        socketMessage.setTitle("测试标题");
        socketMessage.setContent("测试类容");
//        WebSocketService.sendMessage(socketMessage);
        return new ResultTo();
    }

    @GetMapping("/{appId}")
    public ResultTo huanKuan(@PathVariable("appId") String appId) {
        Application application = new Application();
        application.setApplicationId(appId);
        application.setApplicationStatus(ApplicationStatusEnum.FINISH.getType());
        applicationService.updateByPrimaryKeySelective(application);
        return new ResultTo();
    }
}
